package com.foreknow.demo03;
// 将一个数组中的重复元素保留一个其他的清零。
public class Arraylianxi {
    public static void main(String[] args) {
        int []arr1 = new int[]{5,5,2,2,9,9,3,3,4,4};
        int []arr2 = new int[]{};
        boolean shuchu = true;
        for (int  i = 0; i < arr1.length; i++) {
            for (int j = 0;j<arr1.length;j++){
                if (arr1[i]==arr1[j]&& i != j ) {
                    arr1[i] = arr1[j];
                }
            }
        }
        for (int i = 0;i<arr1.length;i++){
            if (arr1[i] != 0){
                System.out.println(arr1[i]);
            }
        }
    }
}